<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>用户</title>
  <link rel="stylesheet" href="/assets/css/iconfont.css">
  <link rel="stylesheet" href="/assets/libs/bootstrap.min.css">
  <link rel="stylesheet" href="/assets/css/base.css">
  <link rel="stylesheet" href="/assets/css/ad-public.css">
  <link rel="stylesheet" href="/assets/css/ad-public.css">
  <link rel="stylesheet" href="/assets/css/user.css">

</head>

<body>
  <!-- 侧边栏 -->
  @@include('../assets/common/admin/adminNav.html')


  <!-- 主体 -->
  <div class="main">
    <!-- 头部 -->
    @@include('../assets/common/admin/adminMainHeader.html')
    <!-- 内容区 -->
    <div class="content">
      <div class="page-title">
        <h3>用户</h3>
      </div>

      <div class="row">
        <div class="col-md-4 user">
          <form class="addUser">
            <h4 style="margin-bottom: 10px; font-weight: 300;">添加新用户</h4>
            <div class="form-group">
              <label>头像</label>
              <div class="form-group">
                <label class="form-image">
                  <input id="feature" type="file">
                  <img src="/assets/img/default.png" class="addUserImg">
                  <i class=" iconfont icon-shangchuan"></i>
                  <input type="hidden" id="avatar" name="avatar">
                </label>
              </div>
            </div>
            <div class="form-group">
              <label>邮箱</label>
              <input class="form-control" type="email" name="email" placeholder="请输入邮箱">
            </div>
            <div class="form-group">
              <label>昵称</label>
              <input class="form-control" name="nickName" type="text" placeholder="请输入昵称">
            </div>
            <div class="form-group">
              <label>密码</label>
              <input class="form-control" name="password" type="password" placeholder="请输入密码">
            </div>
            <div class="form-group">
              <div class="radio-inline">
                <label><input type="radio" name="status" value="0">未激活</label>
              </div>
              <div class="radio-inline">
                <label><input type="radio" name="status" value="1">激活</label>
              </div>
            </div>
            <div class="form-group">
              <div class="radio-inline">
                <label><input type="radio" name="role" value="admin">超级管理员</label>
              </div>
              <div class="radio-inline">
                <label><input type="radio" name="role" value="normal">普通用户</label>
              </div>
            </div>
            <div class="form-group">
              <button class="btn btn-primary" type="submit">添加</button>
            </div>

          </form>
        </div>
        <div class="col-md-8">
          <table class="table table-striped table-bordered table-hover">
            <thead>
              <tr>
                <th class="text-center" width="40"><input type="checkbox"></th>
                <th class="text-center" width="80">头像</th>
                <th>邮箱</th>
                <th>昵称</th>
                <th>状态</th>
                <th>角色</th>
                <th class="text-center" width="100">操作</th>
              </tr>
            </thead>
            <tbody class="userInfo">

            </tbody>
          </table>
        </div>
      </div>
    </div>
  </div>


  <!-- 删除模态框 -->
  <div class="modul hide">
    <div class="mosk"></div>
    <div class="content">
      <div class="item">
        <h3>确定要删除吗？</h3>
      </div>
      <div class="btn">
        <a href="javascript:;" class="delete">删除</a>
        <a href="javascript:;" class="cancel">取消</a>
      </div>
    </div>
  </div>
  <div class="modul hide">
    <div class="mosk"></div>
    <div class="content">
      <div class="item">
        <h3>确定要删除吗？</h3>
      </div>
      <div class="btn">
        <a href="javascript:;" class="delete">删除</a>
        <a href="javascript:;" class="cancel">取消</a>
      </div>
    </div>
  </div>


  @@include('../assets/common/adminBase.html')
  <!-- 所用用户信息模板 -->
  <script type="text/template" id="allUserInfo">
    {{each result}}
    <tr>
      <td class="text-center"><input type="checkbox"></td>
      <td class="text-center"><img class="avatar" src="{{$value.avatar?$value.avatar:'/assets/img/default.png'}}"></td>
      <td>{{$value.email}}</td>
      <td>{{$value.nickName}}</td>
      <td>{{$value.status==1?'激活':'未激活'}}</td>
      <td>{{$value.role=='admin'?'管理员':'普通用户'}}</td>
      <td class="text-center handle">
        <a href="javascript:;" data-id="{{$value._id}}" class="btn btn-default btn-xs edit-btn">编辑</a>
        <a href="javascript:;" data-id="{{$value._id}}" class="btn btn-danger btn-xs delete-btn">删除</a>
      </td>
    </tr>
    {{/each}}
  </script>

  <!-- 编辑用户模板 -->

  <script type="text/template" id="editUserInfo">
    <form class="editUser">
      <h4 style="margin-bottom: 10px; font-weight: 300;">编辑新用户</h4>
      <div class="form-group">
        <label>头像</label>
        <div class="form-group">
          <label class="form-image">
            <input id="feature" type="file">
            <img src="{{result.avatar}}"  class="addUserImg">
            <i class=" iconfont icon-shangchuan"></i>
            <input type="hidden" id="avatar" value="{{result.avatar}}" name="avatar">
          </label>
        </div>
      </div>
      <div class="form-group">
        <label>邮箱</label>
        <input class="form-control" type="email" name="email" value="{{result.email}}" placeholder="请输入邮箱">
      </div>
      <div class="form-group">
        <label>昵称</label>
        <input class="form-control" name="nickName" type="text" value="{{result.nickName}}" placeholder="请输入昵称">
      </div>
      <div class="form-group">
        <label>密码</label>
        <input class="form-control" name="password" type="password" placeholder="请输入密码">
      </div>
      <div class="form-group">
        <div class="radio-inline">
          <label><input type="radio" name="status" value="{{result.status==0?0:1}}">未激活</label>
        </div>
        <div class="radio-inline">
          <label><input type="radio" name="status" value="{{result.status==1?1:0}}">激活</label>
        </div>
      </div>
      <div class="form-group">
        <div class="radio-inline">
          <label><input type="radio" name="role" value="admin">超级管理员</label>
        </div>
        <div class="radio-inline">
          <label><input type="radio" name="role" value="normal">普通用户</label>
        </div>
      </div>
      <div class="form-group">
        <button class="btn btn-primary" type="submit">修改</button>
      </div>

    </form>

  </script>

  <script src="../js/admin/user.js"></script>
</body>

</html>